Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@uxland/event-aggregator
Advanced tools
Build Status | Statements | Branches | Functions | Lines |
---|---|---|---|---|
npm i @uxland/event-aggregator
It is possible to define numerous instances of the Event Aggregator within a project, each one with the same or different events subscribed, simulating each instance as a new channel of communication.
const EA = new EventAggregator();
const EA2 = new EventAggregator();
EA.subscribe('event', () => {...});
EA2.subscribe('event2', () => {...});
EA.subscribe('common-event', () => {...});
EA2.subscribe('common-event', () => {...});
To publish an event you must specify an eventId and an optional payload that will be collected by subscriber.
const payload = { foo: "bar" };
publish("EVENT-ID", payload);
It is possible also to provide a class instead of a string event
publish(new Klass(), callback);
If a subscription is done with provided class, the callback provided at the subscription moment will be called.
In order to subscribe to an event you must specify an eventId and a callback function that will be called when that event is received.
const callback = (payload: any): void => {};
subscribe("EVENT-ID", callback);
It is possible also to provide a class instead of a string event
subscribe(Klass, callback);
In order to subscribe to an event, only once, you must specify an eventId and a callback function that will be called when that event is received. For the next publishes of that event, this subscriber will not receive that event.
const callback = (payload: any): void => {};
subscribeOnce("EVENT-ID", callback);
FAQs
Event Aggregator
We found that @uxland/event-aggregator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.